<!DOCTYPE html>
<html lang="en">

<head>
    <title>品学联萌</title>
    <#include "/pxlm/app/product/components/meta.html" />
    <#include "/pxlm/app/product/components/stylesheets.html" />
    <link rel="stylesheet" href="/pxlm/app/product/stylesheets/index.css?v=4">
</head>

<body>
    <div id="app">
        <header data-am-widget="header" class="am-header am-header-default am-header-fixed" style="background:url('/pxlm/img/pxlmappbanner.png') no-repeat center">
            <h1 class="am-header-title">品学联萌</h1>
        </header>
        <div class="banner">
            <img src="/pxlm/app/product/assets/img/test.jpg" />
        </div>
        <div class="category">
            <div class="title">
                <img src="/pxlm/app/product/assets/img/category_title.png" />
            </div>
            <div class="list">
                <div class="item" v-for="(item, index) in categories" :key="index" @click="goCategoryDetail(item)">
                    <img src="/pxlm/app/product/assets/img/icon1.png" />
                    <span>{{ item.title }}</span>
                </div>
            </div>
        </div>
        <div class="inform">
            <div class="title">重要：购买课程前必看！！</div>
        </div>
        <#include "/pxlm/app/product/components/tabbar.html" />
    </div>
    <#include "/pxlm/app/product/components/scripts.html" />
    <script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data() {
            return {
                categories: []
            }
        },
        mounted: function() {
            this.init();
        },
        methods: {
            init() {
                var url = '${host!}/pxlm/app/product/api/category';
                var params = {};
                var success = res => {
                    console.log(res);
                    this.categories = res.info;
                }
                var fail = res => {
                    console.log(res);
                }
                var complete = () => {}
                request(url, params, success, fail, complete);
            },
            goCategoryDetail(item) {
                window.location.href = '/pxlm/app/product/majors?categoryId=' + item.id;
            }
        }
    })
    </script>
</body>

</html>